package com.yl.project.lvyou.record.service.impl;

import java.util.List;
import com.yl.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yl.project.lvyou.record.mapper.PaymentRecordMapper;
import com.yl.project.lvyou.record.domain.PaymentRecord;
import com.yl.project.lvyou.record.service.IPaymentRecordService;
import com.yl.common.utils.text.Convert;
import com.yl.framework.config.BaseService;

/**
 * 支付记录Service业务层处理
 * 
 * @author yl
 * @date 2025-03-15
 */
@Service
public class PaymentRecordServiceImpl extends BaseService<PaymentRecord> implements IPaymentRecordService 
{
    @Autowired
    private PaymentRecordMapper paymentRecordMapper;

    /**
     * 查询支付记录
     * 
     * @param id 支付记录ID
     * @return 支付记录
     */
    @Override
    public PaymentRecord selectPaymentRecordById(Long id)
    {
        return paymentRecordMapper.selectPaymentRecordById(id);
    }

    /**
     * 查询支付记录列表
     * 
     * @param paymentRecord 支付记录
     * @return 支付记录
     */
    @Override
    public List<PaymentRecord> selectPaymentRecordList(PaymentRecord paymentRecord)
    {
        return paymentRecordMapper.selectPaymentRecordList(paymentRecord);
    }

    /**
     * 新增支付记录
     * 
     * @param paymentRecord 支付记录
     * @return 结果
     */
    @Override
    public int insertPaymentRecord(PaymentRecord paymentRecord)
    {
        paymentRecord.setCreateTime(DateUtils.getNowDate());
        return paymentRecordMapper.insertPaymentRecord(paymentRecord);
    }

    /**
     * 修改支付记录
     * 
     * @param paymentRecord 支付记录
     * @return 结果
     */
    @Override
    public int updatePaymentRecord(PaymentRecord paymentRecord)
    {
        paymentRecord.setUpdateTime(DateUtils.getNowDate());
        return paymentRecordMapper.updatePaymentRecord(paymentRecord);
    }

    /**
     * 删除支付记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePaymentRecordByIds(String ids)
    {
        return paymentRecordMapper.deletePaymentRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除支付记录信息
     * 
     * @param id 支付记录ID
     * @return 结果
     */
    @Override
    public int deletePaymentRecordById(Long id)
    {
        return paymentRecordMapper.deletePaymentRecordById(id);
    }

    @Override
    public PaymentRecord selectPaymentRecordByOrderNo(String orderNo) {
        return paymentRecordMapper.selectPaymentRecordByOrderNo(orderNo);
    }
}
